from datetime import datetime
from typing import Optional
from pydantic import BaseModel, ConfigDict
from .base_schema import BaseSchema


class ProfitBase(BaseSchema):
    order_no: str
    factor_no: str
    factor_name: str
    trans_amount: int
    trans_fee: int
    profit_amount: int
    cost_amount: int
    cost_fee_value: int
    fee_mode: int
    chn_cost_amount: int
    sub_acc_no: Optional[int] = None
    factor_lvl: int
    order_type: int
    pay_type: int
    

class NewProfitDetail(ProfitBase):
    merc_no: str
    profit_rate: Optional[int] = None
    cost_fee_value: Optional[int] = None
    trans_time: Optional[datetime | float | str | int] = None

class ProfitDetail(ProfitBase):
    profit_rate: Optional[int] = None
    cost_fee_value: Optional[int] = None
    chn_fee_value: Optional[int] = None
    factor_lvl: int
    credit_status: int
    credit_time: Optional[datetime]
    create_time: Optional[datetime]
    update_time: Optional[datetime]

class ProfitFull(ProfitDetail):
    id: int

